const en = {
    index: {
        QUICK_MATCH_title: 'QUICK MATCH',
        MULTI_title: 'MULTI',
        SINGLE_title: 'SINGLE',
        FREE_BUILD_title: 'FREE BUILD',
        Newbie_Tutorial_title: 'TUTORIAL',
        ME_title: 'ME',
        RANK_title: 'RANK',
        SETTING_title: 'SETTING',
        haveFun: 'HAVE A GOOD TIME ～(∠・ω< )⌒☆',
        welcome: 'WELCOME BACK !',
    },
    multi: {
        createRoom: 'CREATE ROOM',
        roomList: 'ROOM LIST',
        multiBattle: 'MULTI BATTLE',
        rankBattle: 'RANK BATTLE',
    },
    me: {
        logout: 'Logout',
        joinedDays: 'Joined {days} days ago',
        gameTotal: 'Game Total',
        confirmLogout: 'Are you sure you want to log out?',
        cancelLogout: 'Cancel Logout',
        cancel: 'Cancel',
        confirm: 'Confirm',
        logoutSuccess: 'Successfully logged out',
    },
    setting: {
        back: 'BACK',
        config: 'CONFIG',
        control: 'CONTROL',
        handling: 'HANDLING',
        sound: 'SOUND',
        dglab: 'DG-LAB',
        virtualButton: 'Virtual Button',
        clickToChangePosition: 'Click to change virtual button position',
        keyDown: 'KEY DOWN',
        enable: 'ENABLE',
        status: 'STATUS',
        networkError:
            'The network error. Please refresh the page or check the network connection.',
        connected: 'Connected',
        clickToConnect: 'Click to connect app',
        channelA: 'Channel A',
        channelB: 'Channel B',
        sortLimit: 'sort limit',
        gameStrength: 'game strength',
        damageStrength: 'damage strength',
        gameoverStrength: 'gameover strength',
        test: 'test',
        qrCodeTitle:
            'Use DG-LAB APP to select Socket control then click connect server to scan code',
    },
    keyboard: {
        moveLeft: 'MOVE LEFT',
        moveRight: 'MOVE RIGHT',
        hardDrop: 'HARD DROP',
        softDrop: 'SOFT DROP',
        hold: 'HOLD',
        rotate: 'ROTATE',
        rotateBack: 'ROTATE BACK',
        pause: 'PAUSE',
        restart: 'RESTART',
    },
    config: {
        language: 'LANGUAGE',
        autoPause: 'AUTO PAUSE',
        das: 'DAS',
        arr: 'ARR',
        sortArr: 'SORT ARR',
    },
    login: {
        title: {
            login: 'Login',
            register: 'Register',
            emailLogin: 'Email Login',
            phoneLogin: 'Phone Login',
        },
        placeholder: {
            account: 'Your Account',
            password: 'Your Password',
            rePassword: 'Your Password Again',
            email: 'Your Email',
            verifyCode: 'Verification Code',
            phone: 'Your Phone Number',
        },
        button: {
            next: 'Next',
            login: 'Log In',
            signIn: 'Sign In',
            sendCode: 'Send Code',
            resendCode: 'Resend',
            back: 'Back',
            emailLogin: 'Login',
            phoneLogin: 'Login',
        },
        divider: 'or',
        tooltip: {
            qq: 'Scan with QQ to login',
            wechat: 'Scan with WeChat to login',
            email: 'Login with Email',
            phone: 'Login with Phone',
        },
        error: {
            emptyAccount: 'Account cannot be empty',
            emptyPassword: 'Password cannot be empty',
            invalidAccount: 'Invalid account name! Please try another account.',
            accountExists:
                'This account has been registered! Please try another account.',
            passwordMismatch:
                'Please confirm that the passwords entered twice are consistent!',
            wrongPassword: 'Wrong password!',
            qqLoginFailed: 'QQ login failed, please try again',
            emptyEmail: 'Email cannot be empty',
            invalidEmail: 'Please enter a valid email address',
            sendCodeFailed: 'Failed to send verification code, please try again',
            geetestError: 'Geetest verification failed, please try again',
            emptyCode: 'Verification code cannot be empty',
            invalidCode: 'Invalid verification code',
            verifyCodeFailed: 'Failed to verify code, please try again',
            emptyPhone: 'Phone number cannot be empty',
            invalidPhone: 'Please enter a valid phone number',
            pleaseTryAgain: 'Please try again',
            networkError: 'Network connection error, please try again',
        },
        success: {
            login: 'Login successful',
        },
        message: {
            codeSent: 'Verification code has been sent, please check your email',
        },
    },
};

const zn = {
    index: {
        QUICK_MATCH_title: '快速匹配',
        MULTI_title: '多人对战',
        SINGLE_title: '单人游戏',
        FREE_BUILD_title: '自定义地图',
        Newbie_Tutorial_title: '新手教程',
        ME_title: '我的',
        RANK_title: '排名',
        SETTING_title: '设置',
        haveFun: '玩得开心～(∠・ω< )⌒☆',
        welcome: '欢迎回来！',
    },
    multi: {
        createRoom: '创建房间',
        roomList: '房间列表',
        multiBattle: '多人对战',
        rankBattle: '排名对战',
    },
    me: {
        logout: '退出登录',
        joinedDays: '已加入游戏 {days} 天',
        gameTotal: '对局统计',
        confirmLogout: '您确定要退出登录吗？',
        cancelLogout: '是否取消登录',
        cancel: '取消',
        confirm: '确定',
        logoutSuccess: '已成功退出登录',
    },
    setting: {
        back: '返回',
        config: '全局',
        control: '按键操作',
        handling: '游戏设置',
        sound: '声音设置',
        dglab: 'DG-LAB',
        virtualButton: '虚拟按键',
        clickToChangePosition: '点击更改虚拟按键位置',
        keyDown: '按下按键',
        enable: '启用',
        status: '状态',
        networkError: '网络错误。请刷新页面或检查网络连接。',
        connected: '已连接',
        clickToConnect: '点击连接郊狼App',
        channelA: '通道A',
        channelB: '通道B',
        sortLimit: '软上限',
        gameStrength: '游戏期间强度',
        damageStrength: '受到攻击时强度',
        gameoverStrength: '游戏结束强度',
        test: '测试波形',
        qrCodeTitle: '使用DG-LAB APP 选择Socket控制后 点击连接服务器进行扫码',
    },
    keyboard: {
        moveLeft: '向左移动',
        moveRight: '向右移动',
        hardDrop: '硬降',
        softDrop: '软降',
        hold: '暂存',
        rotate: '顺时针旋转',
        rotateBack: '逆时针旋转',
        pause: '暂停',
        restart: '重新开始',
    },
    config: {
        language: '语言',
        autoPause: '自动暂停',
        das: '方块快速移动延迟',
        arr: '方块快速移动速度',
        sortArr: '方块软降速度',
    },
    login: {
        title: {
            login: '登录',
            register: '注册',
            emailLogin: '邮箱登录',
            phoneLogin: '手机登录',
        },
        placeholder: {
            account: '请输入账号',
            password: '请输入密码',
            rePassword: '请再次输入密码',
            email: '请输入邮箱',
            verifyCode: '请输入验证码',
            phone: '请输入手机号',
        },
        button: {
            next: '下一步',
            login: '登录',
            signIn: '登录',
            sendCode: '发送验证码',
            resendCode: '重新发送',
            back: '返回',
            emailLogin: '登录',
            phoneLogin: '登录',
        },
        divider: '第三方账号登录',
        tooltip: {
            qq: '使用QQ扫码登录',
            wechat: '使用微信扫码登录',
            email: '使用邮箱登录',
            phone: '使用手机号登录',
        },
        error: {
            emptyAccount: '账号不能为空喵',
            emptyPassword: '密码不能为空喵',
            invalidAccount: '账号名称不合法！请尝试其他账号重试！',
            accountExists: '该账号已被注册！请尝试其他账号重试！',
            passwordMismatch: '请确认两次输入的密码是否一致！',
            wrongPassword: '密码错误！',
            qqLoginFailed: 'QQ登录失败，请重试',
            emptyEmail: '邮箱不能为空喵',
            invalidEmail: '请输入正确的邮箱格式',
            sendCodeFailed: '验证码发送失败，请重试',
            geetestError: '验证码加载失败，请刷新页面重试',
            emptyCode: '验证码不能为空喵',
            invalidCode: '验证码错误',
            verifyCodeFailed: '验证码验证失败，请重试',
            emptyPhone: '手机号不能为空喵',
            invalidPhone: '请输入正确的手机号格式',
            pleaseTryAgain: '校验不成功，请重试',
            networkError: '网络连接错误，请重试',
        },
        success: {
            login: '登录成功',
        },
        message: {
            codeSent: '验证码已发送，请注意查收',
        },
    },
};

// 枚举lang
const LangList: { cn: string; en: string; value: string }[] = [
    {
        cn: '简体中文',
        en: 'Chinese',
        value: 'zn',
    },
    {
        cn: '英语',
        en: 'English',
        value: 'en',
    },
    // 添加其他语言选项...
];

// 当前浏览器语言
const lang = navigator.language.toLowerCase();

const i18nConfig = {
    locale: lang == 'zn' ? 'zn' : 'en', // 默认语言
    fallbackLocale: 'en', // 降级语言
    messages: {
        zn,
        en,
    },
};

import { createI18n } from 'vue-i18n';
const i18n = createI18n(i18nConfig);

export { LangList, i18nConfig, i18n };
